/// <license>
/// Copyright (c) 2002-2008, DotNetNuke Corporation
/// All rights reserved
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
/// documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
/// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and 
/// to permit persons to whom the Software is furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all copies or substantial portions 
/// of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
/// TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
/// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
/// CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
/// DEALINGS IN THE SOFTWARE.
/// </license>

#region Using Statements

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Text;

using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Users;
using DotNetNuke.Entities.Modules;
using DotNetNuke.Entities.Portals;
using DotNetNuke.UI.WebControls;
using System.Xml.Serialization;
using System.Data;

#endregion

namespace DotNetNuke.ModuleToolkit.Framework
{
    /// -----------------------------------------------------------------------------
    /// <summary>
    /// The AuditInfo Class represents an Audit History item.
    /// </summary>
    /// <history>
    /// 	[cnurse]	09/12/2007	Created
    /// </history>
    /// -----------------------------------------------------------------------------
    public class AuditInfo : IHydratable
    {

        #region Private Members

        private DateTime _AuditDate;
        private string _AuditType;
        private string _AuditUser;
        private string _Comment;
        private int _ItemId;
        private int _VersionNo;

        #endregion

        #region Public Properties

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Date that the Audit Info was created
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public DateTime AuditDate
        {
            get { return _AuditDate; }
            set { _AuditDate = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Type that the Audit Info was created
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public string AuditType
        {
            get { return _AuditType; }
            set { _AuditType = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the User that created the Audit Info
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public string AuditUser
        {
            get { return _AuditUser; }
            set { _AuditUser = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Comment
        /// </summary>
        /// <history>
        /// 	[cnurse]	10/03/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public string Comment
        {
            get { return _Comment; }
            set { _Comment = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Item Id of the Audit Info object
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public int ItemId
        {
            get { return _ItemId; }
            set { _ItemId = value; }
        }

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Gets and sets the Version of the Audit Info object
        /// </summary>
        /// <history>
        /// 	[cnurse]	09/12/2007	Created
        /// </history>
        /// -----------------------------------------------------------------------------
        public int VersionNo
        {
            get { return _VersionNo; }
            set { _VersionNo = value; }
        }

        #endregion

        #region IHydratable Members

        /// -----------------------------------------------------------------------------
        /// <summary>
        /// Hydrates the Audit Info
        /// </summary>
        /// <param name="dr">The Data Reader containing the values to use to fill the object.</param>
        /// <history>
        /// 	[cnurse]	09/12/2007	created
        /// </history>
        /// -----------------------------------------------------------------------------
        public void Fill(IDataReader dr)
        {
            ItemId = Convert.ToInt32(Null.SetNull(dr["ItemID"], ItemId));
            VersionNo = Convert.ToInt32(Null.SetNull(dr["VersionNo"], VersionNo));
            AuditDate = Convert.ToDateTime(Null.SetNull(dr["AuditDate"], AuditDate));
            AuditType = Convert.ToString(Null.SetNull(dr["AuditType"], AuditType));
            AuditUser = Convert.ToString(Null.SetNull(dr["AuditUser"], AuditUser));
        }

        public int KeyID
        {
            get { return ItemId; }
            set { ItemId = value; }
        }

        #endregion
    }
}
